package com.frame.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.frame.action.form.AccountForm;
import com.frame.service.AccountService;

@Controller
@RequestMapping("/login.do")
public class LoginAction extends Action {
	
	@Autowired
	private AccountService accountService;
	
	/*
	 * 初始化表�单
	 * @param model
	 * @return
	 */
	@RequestMapping(method=RequestMethod.GET)
	public String initForm(){
		// 直接跳转到登陆界�面
		return "test/login";
	}
	
	/*
	 * 登录 
	 * @param account
	 * @return
	 */
	@RequestMapping(method=RequestMethod.POST)
	public String login(){
		AccountForm form = paramsToForm(AccountForm.class);
		if(form != null){
			return "redirect:profile.do?id=" + form.getId();
		} else {
			return "redirect:login.do";
		}
	}
}
